Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the dApp to work in Ledger Live #708

Merged
merged 180 commits into from
Nov 6, 2024
Merged

Update the dApp to work in Ledger Live #708

merged 180 commits into from
Nov 6, 2024

Conversation

kkosiorowska
Copy link
Contributor

@kkosiorowska kkosiorowska commented Aug 20, 2024

This is an integration PR that adds the necessary changes for the dapp to run on Ledger Live.

Refs: #730 #742 #763 #759, #760, #797, #780, https://github.com/thesis/orangekit/pull/143, https://github.com/thesis/orangekit/pull/144

Important note

Changes can only be tested in a Ledger Live app built from source. See the Ledger Live repo, how to build from source.

Based on the template we want to build the ledger live manifest based on the `mainnet`, `testnet` and `development`config. In config we set the correct id, name and url.
Copy link

netlify bot commented Aug 20, 2024

Deploy Preview for acre-dapp ready!

Name Link
🔨 Latest commit 5f0d436
🔍 Latest deploy log https://app.netlify.com/sites/acre-dapp/deploys/672b8b157537f80008afae5a
😎 Deploy Preview https://deploy-preview-708--acre-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Aug 20, 2024

Deploy Preview for acre-dapp-testnet ready!

Name Link
🔨 Latest commit 5f0d436
🔍 Latest deploy log https://app.netlify.com/sites/acre-dapp-testnet/deploys/672b8b15f546010008c5d1d2
😎 Deploy Preview https://deploy-preview-708--acre-dapp-testnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kkosiorowska kkosiorowska self-assigned this Aug 21, 2024
kkosiorowska and others added 12 commits September 20, 2024 10:35
This PR adds the Ledger Live connector from the orangekit lib.
This PR integrates the app with OrnageKit which delivers the provider
for the Ledger Live App. The implementation of Ledger Live App support
should not cause regression for previous solutions. The app should catch
via the `embed` parameter in the URL if it works under the Ledger Live
App. If such a parameter is found, in the wgami configuration we should
specify only one right connector.


### Testing

- [ ] Do the account connection (connection + signing the message)
- [ ] Do the deposit flow.
- [ ] Do the withdraw flow.
We configured netlify branch deployments for this feature branch, so we
can use
`https://ledger-live-updates--acre-dapp-testnet.netlify.app/?embed=ledger-live`
here.
Copy link
Member

@nkuba nkuba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a problem with the withdrawal flow. When I click the "Withdraw" button, the modal gets switched to Deposit form.

Screen_Recording_2024-11-05_at_12.14.34.mov

Comment on lines 57 to 58
eip1193.didUserRejectRequest(error) ||
ledgerLive.didUserRejectRequest(error)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we combine these two with one common utils function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 115 to 116
eip1193.didUserRejectRequest(error) ||
ledgerLive.didUserRejectRequest(error)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we combine these two with one common utils function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dapp/src/constants/wallets.ts Outdated Show resolved Hide resolved
dapp/config/mainnet.json Outdated Show resolved Hide resolved
dapp/config/testnet.json Outdated Show resolved Hide resolved
@nkuba nkuba added this to the Ledger Live Launch milestone Nov 6, 2024
When the modal is open the buttons on the sidebar don't work. This
commit fixes it.
The Ledger throws an error with `Signature interrupted by user` message
when a user closes the transaction/sign message native window. We check
if the error thrown by Ledger has this message and throw
`UserRejectedRequestError` from `viem` to be consistent with orangekit
package.
`LEDGER` -> `LEDGER_LIVE`.
Update the url to `bitcoin.acre.fi` and `bitcoin.test.acre.fi`.
@nkuba nkuba added the 🎨 dapp dApp label Nov 6, 2024
r-czajkowski and others added 10 commits November 6, 2024 12:05
We need a single source of true for a connected Bitcoin address, so we
store it in the redux store. Otherwise, the `useEffect` hook that
fetches the Bitcoin address causes unnecessary updates of other hooks.
Set the full id in config instead of `acre-<id>` template. The `id` for
the mainnet must be just `acre`.
Closes: #795
Closes: #799 
Closes: #806

### Changes
<details>
<summary>Added `AcrePointsCard` component's conditional tooltip (depends
if wallet is connected) </summary>
<img width="545" alt="image"
src="https://github.com/user-attachments/assets/d85ce22d-5f15-40cd-96d1-4848e0bc73fe">
<img width="545" alt="image"
src="https://github.com/user-attachments/assets/7d5b4d5f-a215-4e09-b6f1-ed42573bff0c">
</details>
<details>
  <summary>Added `BeehiveCard` component's tooltip</summary>
<img width="545" alt="image"
src="https://github.com/user-attachments/assets/7097c3f9-9cc2-47c5-bd50-5d4d77a9df34">
</details>
<details>
<summary>Added `withToolip` prop to `CurrencyBalance` component which
renders full (not truncated) amount of the activity</summary>
<img width="651" alt="image"
src="https://github.com/user-attachments/assets/493f7d1e-f1a7-41e9-b4d6-b32375833795">
</details>

### Note
UI changes (colors, sizes) are not included. This PR includes
content/functionality changes only.
@@ -101,7 +103,7 @@ export const walletSlice = createSlice({
const activityId = action.payload
delete state.latestActivities[activityId]
},
resetState: () => initialState,
resetState: (state) => ({ ...initialState, address: state.address }),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we also reset the address state?

Copy link
Member

@nkuba nkuba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that there are no more blocking comments. This PR introduces many improvements to both Standalone and Ledger Live dApp and blocks other PRs.

I'll merge this PR, but @r-czajkowski please address all the unresolved comments in a follow-up PR and @kkosiorowska feel free to propose the improvements.

@nkuba nkuba merged commit d1ef7d6 into main Nov 6, 2024
28 checks passed
@nkuba nkuba deleted the ledger-live-updates branch November 6, 2024 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants